/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wordpress.fareastdan.FEDTradeManagerIDE.FEDConnectionManager;
import java.awt.event.ActionEvent;
import java.beans.IntrospectionException;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JOptionPane;
import org.openide.ErrorManager;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.nodes.PropertySupport;
import org.openide.nodes.Sheet;
import org.openide.util.lookup.Lookups;

/**
 *
 * @author user
 */
public class FEDServerRootNode extends AbstractNode
{
    public FEDServerRootNode()
    {
        super(Children.LEAF);
        //super (Children.create(new FEDServerChildFactory(), true));

        setDisplayName ("Servers managed by this console");    
        this.setShortDescription("Right click to manage new servers");
    }    
    
    @Override
    public Action[] getActions (boolean popup) 
    {
        return new Action[] { new FEDServerRootNodeEvent() };
    }
    
    @Override
    protected Sheet createSheet() 
    {

        Sheet sheet = Sheet.createDefault();
        Sheet.Set set = Sheet.createPropertiesSet();

        try 
        {
           // Property indexProp = new PropertySupport.Reflection(obj, Integer.class, "getIndex", null);
           // Property dateProp = new PropertySupport.Reflection(obj, Date.class, "getDate", null);

          //  indexProp.setName("index");
          //  dateProp.setName("date");

          //  set.put(indexProp);
          //  set.put(dateProp);

        } 
        catch (Exception ex) 
        {
            ErrorManager.getDefault();
        }

        sheet.put(set);
        return sheet;

    }
}

class FEDServerRootNodeEvent extends AbstractAction
{
    public FEDServerRootNodeEvent() 
    {
        putValue (NAME, "Add a new Server");
    }

    @Override
    public void actionPerformed(ActionEvent e) 
    {
        JOptionPane.showMessageDialog(null, "Hello from ");
    }
}

